package com.zy.dp.prototype.example5;

public class Client
{
	public static void main(String[] args)
	{
		try
		{
			Prototype p1 = new ConcretePrototypeA();
			PrototypeManage.setPrototype("prototypeA", p1);
			Prototype p3 = PrototypeManage.getPrototype("prototypeA").clone();
			p3.setName("张三");
			System.out.println(p3);

			Prototype p2 = new ConcretePrototypeB();
			PrototypeManage.setPrototype("prototypeB", p2);
			Prototype p4 = PrototypeManage.getPrototype("prototypeB").clone();
			p4.setName("李四");
			System.out.println(p4);

			PrototypeManage.removePrototype("prototypeA");

			Prototype p5 = PrototypeManage.getPrototype("prototypeA").clone();
			p5.setName("王五");
			System.out.println(p5);

		}
		catch (Exception e)
		{
			System.out.println(e.getMessage());
		}

	}
}
